"""
name = 'studentSystem'
datetime ='2020/11/19 22:28'

❣ฅ(▼▾▼)ฅ

"""
# -*-encoding = UTF-8-*-

"""
异常捕捉练习
"""


# class Person(object):
#     def __init__(self,age):
#         age = input("请输入你的年龄")
#         self.age = age
#
#     def msgPrint(self):
#         if self.age > 6 and self.age < 13:
#             print("你是一位小学生")
#         elif self.age > 13:
#             print()
#         else:
#             print("你是幼儿园的小朋友")
#
# try:
#     child = Person(6)
#     child.msgPrint()
# except TypeError as error:
#     print("错误信息：%s " % error)
# else:
#     print("没有异常")
# finally:
#     print("运行结束finally")


# 异常类
class lenError(Exception):

    def __init__(self, length):
        self.length = length

def main():
    try:
        myTel = input("请输入你的手机号")
        if len(myTel) != 11:
            raise lenError(len(myTel))
    except lenError as result:
        print("你输入的长度是%d " % result.length)

main()